<?php

namespace app\api\validate;

use think\Validate;

class Order extends Validate
{
    protected $failException = true;
//,'school','age','phone'
    protected $rule = [
        'course_id' => 'require',
        'name' => 'require',
        'school'=>'require',
        'age'=>'require|number',
        'phone'=>'require',
        'grade'=>'require'
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create' => ['course_id','name','school','age','phone','grade'],
    ];

    public function __construct()
    {
        $this->field = [
            'username' => __('username'),
            'nickname' => __('nickname'),
            'birthday' => __('birthday'),
            'email' => __('email'),
            'mobile' => __('mobile'),
            'password' => __('password'),
        ];
        $this->message = array_merge($this->message, [
            'nickname.chsDash' => __('nicknameChsDash'),
            'password.regex' => __('Please input correct password')
        ]);
        parent::__construct();
    }

}